/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package services;

import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import session.DoctorSessionBeanRemote;
import session.UsernameSessionBeanRemote;

/**
 *
 * @author Andreea
 */
@WebService(serviceName = "UserWebService")
@Stateless()
public class UserWebService {
    @EJB
    private DoctorSessionBeanRemote doctorSessionBean;
    @EJB
    private UsernameSessionBeanRemote ejbRef;// Add business logic below. (Right-click in editor and choose
    
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "addUsername")
    @Oneway
    public void addUsername(@WebParam(name = "username") String username, @WebParam(name = "password") String password) {
        ejbRef.addUsername(username, password);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "addDoctor")
    public void addDoctor(@WebParam(name = "name") String name, @WebParam(name = "specialty") String specialty, @WebParam(name = "username") String username, @WebParam(name = "password") String password) {
        //TODO write your implementation code here:
        doctorSessionBean.addDoctor(name, specialty, username, password);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "login")
    public long login(@WebParam(name = "username") String username, @WebParam(name = "password") String password) {
        //TODO write your implementation code here:
        return ejbRef.login(username, password);
    }
    
    
}
